/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package tracker.pc.com.impl;

import ecore.EcorePackage;

import ecore.impl.EcorePackageImpl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

import tracker.android.nativelib.NativelibPackage;

import tracker.android.nativelib.impl.NativelibPackageImpl;

import tracker.android.sens.SensPackage;

import tracker.android.sens.impl.SensPackageImpl;

import tracker.pc.com.ComFactory;
import tracker.pc.com.ComPackage;
import tracker.pc.com.ProcessConnectionThread;
import tracker.pc.com.RemoteBluetoothServer;
import tracker.pc.com.ServerThread;
import tracker.pc.com.StreamConnection;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ComPackageImpl extends EPackageImpl implements ComPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass remoteBluetoothServerEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass serverThreadEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass processConnectionThreadEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass streamConnectionEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see tracker.pc.com.ComPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private ComPackageImpl() {
		super(eNS_URI, ComFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link ComPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static ComPackage init() {
		if (isInited) return (ComPackage)EPackage.Registry.INSTANCE.getEPackage(ComPackage.eNS_URI);

		// Obtain or create and register package
		ComPackageImpl theComPackage = (ComPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ComPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ComPackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		tracker.android.com.impl.ComPackageImpl theComPackage_1 = (tracker.android.com.impl.ComPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(tracker.android.com.ComPackage.eNS_URI) instanceof tracker.android.com.impl.ComPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(tracker.android.com.ComPackage.eNS_URI) : tracker.android.com.ComPackage.eINSTANCE);
		NativelibPackageImpl theNativelibPackage = (NativelibPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(NativelibPackage.eNS_URI) instanceof NativelibPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(NativelibPackage.eNS_URI) : NativelibPackage.eINSTANCE);
		SensPackageImpl theSensPackage = (SensPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SensPackage.eNS_URI) instanceof SensPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SensPackage.eNS_URI) : SensPackage.eINSTANCE);
		EcorePackageImpl theEcorePackage = (EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI) instanceof EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI) : EcorePackage.eINSTANCE);

		// Create package meta-data objects
		theComPackage.createPackageContents();
		theComPackage_1.createPackageContents();
		theNativelibPackage.createPackageContents();
		theSensPackage.createPackageContents();
		theEcorePackage.createPackageContents();

		// Initialize created meta-data
		theComPackage.initializePackageContents();
		theComPackage_1.initializePackageContents();
		theNativelibPackage.initializePackageContents();
		theSensPackage.initializePackageContents();
		theEcorePackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theComPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(ComPackage.eNS_URI, theComPackage);
		return theComPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRemoteBluetoothServer() {
		return remoteBluetoothServerEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getServerThread() {
		return serverThreadEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getProcessConnectionThread() {
		return processConnectionThreadEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getProcessConnectionThread_EXT_CMD() {
		return (EAttribute)processConnectionThreadEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getProcessConnectionThread_MConnection() {
		return (EReference)processConnectionThreadEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getProcessConnectionThread_KEY_RIGHT() {
		return (EAttribute)processConnectionThreadEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getProcessConnectionThread_KEY_LEFT() {
		return (EAttribute)processConnectionThreadEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getStreamConnection() {
		return streamConnectionEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComFactory getComFactory() {
		return (ComFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		remoteBluetoothServerEClass = createEClass(REMOTE_BLUETOOTH_SERVER);

		serverThreadEClass = createEClass(SERVER_THREAD);

		processConnectionThreadEClass = createEClass(PROCESS_CONNECTION_THREAD);
		createEAttribute(processConnectionThreadEClass, PROCESS_CONNECTION_THREAD__EXT_CMD);
		createEReference(processConnectionThreadEClass, PROCESS_CONNECTION_THREAD__MCONNECTION);
		createEAttribute(processConnectionThreadEClass, PROCESS_CONNECTION_THREAD__KEY_RIGHT);
		createEAttribute(processConnectionThreadEClass, PROCESS_CONNECTION_THREAD__KEY_LEFT);

		streamConnectionEClass = createEClass(STREAM_CONNECTION);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
		SensPackage theSensPackage = (SensPackage)EPackage.Registry.INSTANCE.getEPackage(SensPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		serverThreadEClass.getESuperTypes().add(theSensPackage.getThread());
		processConnectionThreadEClass.getESuperTypes().add(theSensPackage.getThread());

		// Initialize classes and features; add operations and parameters
		initEClass(remoteBluetoothServerEClass, RemoteBluetoothServer.class, "RemoteBluetoothServer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		EOperation op = addEOperation(remoteBluetoothServerEClass, null, "main", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEString(), "args", 0, -1, IS_UNIQUE, !IS_ORDERED);

		initEClass(serverThreadEClass, ServerThread.class, "ServerThread", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(processConnectionThreadEClass, ProcessConnectionThread.class, "ProcessConnectionThread", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getProcessConnectionThread_EXT_CMD(), theEcorePackage.getEInt(), "EXT_CMD", null, 1, 1, ProcessConnectionThread.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEReference(getProcessConnectionThread_MConnection(), this.getStreamConnection(), null, "mConnection", null, 1, 1, ProcessConnectionThread.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getProcessConnectionThread_KEY_RIGHT(), theEcorePackage.getEInt(), "KEY_RIGHT", null, 1, 1, ProcessConnectionThread.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getProcessConnectionThread_KEY_LEFT(), theEcorePackage.getEInt(), "KEY_LEFT", null, 1, 1, ProcessConnectionThread.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		op = addEOperation(processConnectionThreadEClass, null, "processCommand", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEByte(), "buffer", 0, -1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEInt(), "length", 1, 1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(processConnectionThreadEClass, null, "processCommand", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEInt(), "command", 1, 1, IS_UNIQUE, !IS_ORDERED);

		initEClass(streamConnectionEClass, StreamConnection.class, "StreamConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		// Create resource
		createResource(eNS_URI);
	}

} //ComPackageImpl
